package com.etc.controller;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("forwardapi")
public class ForwardController {
	
	Logger logger = Logger.getLogger(ForwardController.class);

	@RequestMapping(value= {"test1","test123","testxx"})
	public String test1() {
		System.out.println("forwardapi test1");
		logger.info("forwardapi log test1");
		return "test1";
	}

	@RequestMapping(value = "test2")
	public String test2() {
		System.out.println("forwardapi test2:");
		//转发的特征,地址栏不变 ,还是test2,相对目录
		return "forward:test1";
	}
	
	@RequestMapping(value = "test3")
	public String test3() {
		System.out.println("forwardapi test3:");
		//明确告知我们的操作是转发
		//相对路径,大家一定一定一定要知道当前路径在哪 ,明确的走我们forward后的 forwardapi/test3.jsp
		//此时 我们的viewclass设置的前缀和后缀无效
		return "forward:test3.jsp";
	}
	
	@RequestMapping(value = "test4")
	public String test4() {
		System.out.println("forwardapi test4:");
		//明确告知我们的操作是转发
		//绝对路径 ,此时从项目跟下的。。。 等价于我们  return "test4";
		return "forward:/WEB-INF/jsp/test4.jsp";
	}
}
